package com.vanzo.some.interphone;

import android.content.Context;
import android.widget.Toast;

/**
 * Created by tisen on 2017/12/29.
 */

public class ToastUtil {

    private static int DEFAULT_TOAST_DURATION = Toast.LENGTH_SHORT;
    private static Toast toast;


    public static void display(Context context, String s, int duration) {
        if (toast == null) {
            toast = new Toast(context);
        }
        toast.setText(s);
        toast.setDuration(duration);
        toast.show();
    }

    public static void display(Context context, String s) {
        if (toast == null) {
            toast = new Toast(context);
        }
        toast.setText(s);
        toast.setDuration(DEFAULT_TOAST_DURATION);
        toast.show();
    }
}
